package cn.imvc.app.models;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;

import cn.imvc.app.entities.Commission;
import cn.imvc.app.entities.Member;
import cn.imvc.app.entities.Orders;
import cn.imvc.data.domain.ViewRequest;

public interface CommissionModel {
	/**
	 * 通过商品订单提取分佣
	 * @param goodsOrder商品订单
	 */
	void updateOrdersCommission(Orders order);
	
	/**
	 * 查询所有分佣。默认按时间顺序倒序
	 * @param viewRequest
	 * @return
	 */
	Page<Commission> findAll(ViewRequest viewRequest);
	
	/**
	 * 通过用户id查询其分佣
	 * @param viewRequest
	 * @param id
	 * @return
	 */
	Page<Commission> findAllByMemberId(ViewRequest viewRequest, int id);

	void save(Commission commOne);
	/**
	 * 判断此会员本月是否分佣过
	 * @param id
	 * @param string
	 */
	List<Commission> findAllByMemberAndCreatedAtBetween(Member member, Date startTime,Date endTime);

}
